#include "Image.h"

using namespace std;
/*constructeurs*/
Image::Image()
{
    _rectangle = null;
    _texture = null;
    _pos = 0;
}


Image::Image(string filemane)
{
    RessourceManager * RS = ResourceManager::getInstance();
    _texture = RS.getRessource<Texture*>(filename);
    if(!_texture) cout<<"ERROR CHARGEMENT TEXTURE INEXISTANTE"<<endl;
    draw();
    _pos = 0;
}

/*destructeur*/
Image~Image()
{
    _texture.removeRef();
}

/*mutateurs*/
void Image::draw()
{
    glBindTexture(GL_TEXTURE_2D, _texture.getGLID());
    glBegin(GL_QUADS);
    glTexCoord2d(0,1); glVertex2d(0,1);
    glTexCoord2d(0,0); glVertex2d(0,0);
    glTexCoord2d(1,0); glVertex2d(1,0);
    glTexCoord2d(1,1); glVertex2d(1,1);
    glEnd();
}

/*accesseurs*/

/*fonctions membres*/
